extends CanvasLayer
const BUFF_CARD = preload("uid://7i7sc6ti2oeh")
@onready var buff_box: HBoxContainer = $BuffBackGround/BuffBox

func _ready() -> void:
	_hide()
	_init_signal()

func _init_signal() -> void :
	#visibility_changed.connect(_init_card)
	pass

func _init_card() -> void :
	for child in [] if visible else buff_box.get_children() :
		child.queue_free()
	for i in 3 :
		var buff_card = BUFF_CARD.instantiate()
		buff_card.send_select_card.connect(_on_select_card)
		buff_box.call_deferred("add_child",buff_card)

func _on_select_card() -> void :
	print("选择了buff")
	_hide()

func _show() -> void :
	show()
	get_tree().paused = true

func _hide() -> void :
	get_tree().paused = false
	hide()
	call_deferred("_init_card")
